package com.example.mrzhou.lvmm.presenter.home;

import com.example.mrzhou.lvmm.entity.home.HomeContent;
import com.example.mrzhou.lvmm.model.ModelFactory;
import com.example.mrzhou.lvmm.view.impl.home.HomeContentView;

import rx.Subscriber;

/**
 * Created by Mr.zhou on 2016/10/28.
 */

public class HomeContentPresenter {

    private HomeContentView homeContentView;

    public HomeContentPresenter(HomeContentView homeContentView) {
        this.homeContentView = homeContentView;
    }

    public void getHomeContent(String back_word1, String back_word2, Long time){
        ModelFactory.getiHomeModel().getHomeContent(back_word1, back_word2, time, new Subscriber<HomeContent>() {
            @Override
            public void onCompleted() {
                homeContentView.onFinsh();
            }

            @Override
            public void onError(Throwable e) {
                homeContentView.onFaiure(e);
            }

            @Override
            public void onNext(HomeContent homeContent) {
                homeContentView.onSuccess(homeContent);
            }
        });
    }
}
